<html>
<head>
<script type="text/javascript" src="js/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="js/jquery.ba-resize.min.js"></script>
<script type="text/javascript">
var container = new Object();

	$(document).ready(document_geladen);
	
	function document_geladen(){
		console.log("Dokument ist geladen");
		$("#content").css("margin-left",$("#menu").width()+"px");		
		chrome.extension.sendRequest({befehl:6}, contentAuslesen);
	}
	
	function contentAuslesen(response){
		console.log("content auslesen wurde gestartet");
		results = response.content;
		
		var len=results.length, i;
		console.log(len);
		console.log(results);
		for(i=0;i<len;++i)
		{
					var regal = results[i].regal;
					var buch = results[i].buch;
					var kapitel = results[i].kapitel;
					
					if(!container.hasOwnProperty(regal)) container[regal] = new Object();
					if(!container[regal].hasOwnProperty(buch)) container[regal][buch] = new Object();
					if(!container[regal][buch].hasOwnProperty(kapitel)) container[regal][buch][kapitel] = new Object();
		}
		console.log("content wurde in objekte eingespeisst");
		console.log(container);
		console.log("starte darstellung");
		for(var regal in container){
			console.log(regal);
			for(var buch in container[regal]){
				console.log("   "+buch);
				for(var kapitel in container[regal][buch]){
					console.log("      "+kapitel);
				}
			}
		}
		console.log("darstellung beendet");
	}
	

	/*$("#menu").resize(function(){
		$("#content").css("margin-left",$("#menu").width()+"px");
		console.log("resize");
	});
	
	function update(){
		//$("#menu").css("width","60px");
		document.getElementById('menu').innerHTML = " fdsdfgdsfgksdjglkjdsfklhj";
	}*/
	
	
</script>
</head>
<body>

	<div id="menu" style="position:absolute;left:10px;top:10px;border:solid;">test</div>
	<div id="content" style="border:solid;margin-left:200px;">test</div>

</body>
</html>